<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<!--{hook admin_flag_read_start.htm}-->
<div class="container-fluid">
<div class="row">
	<div class="col-lg-12">
		<!--{hook admin_flag_read_breadcrumb_before.htm}-->
		<?php if(empty($hide_breadcrumb)) { ?>
		<ol class="breadcrumb d-none d-md-flex text-muted border-left-primary">
            <li class="breadcrumb-item"><a href="<?php echo url('flag-list', '', TRUE);?>"><i class="icon-home text-primary" aria-hidden="true"></i></a></li>
            <li class="breadcrumb-item"><?php echo $read['name'];?></li>
            <li class="breadcrumb-item"><?php echo lang('list');?></li>
            <!--{hook admin_flag_read_breadcrumb.htm}-->
		</ol>
		<?php } ?>
		<!--{hook admin_flag_read_breadcrumb_after.htm}-->
		<div class="card card-threadlist">
			<div class="card-body">
				<table class="table table-bordered text-center">
					<tbody>
					<?php if(!empty($threadlist)){ foreach($threadlist as $k => &$v) {?>
					<tr>
                        <!--{hook admin_flag_read_table_start.htm}-->
						<td>
							<input type="checkbox" name="id" class="mt-1" value="<?php echo $idarr[$v['tid']]; ?>" />
						</td>
                        <!--{hook admin_flag_read_table_before.htm}-->
						<td class="text-break text-left">
                            <a href="../<?php echo $v['url']; ?>" target="_blank"><?php echo $v['subject'];?></a>
						</td>
                        <!--{hook admin_flag_read_table_middle.htm}-->
						<td>
							<?php echo date('Y-m-d',$v['create_date']);?>
						</td>
                        <!--{hook admin_flag_read_table_after.htm}-->
						<td class="small">
                            <a data-href="<?php echo url('flag-read', array('flagid'=>$flagid,'id'=>$idarr[$v['tid']]));?>" href="javascript:void(0);" class="text-grey delete"><i class="icon-remove"></i> <?php echo lang('delete');?></a>
						</td>
                        <!--{hook admin_flag_read_table_end.htm}-->
					</tr>
					<?php }} ?>
					</tbody>
				</table>
			</div>
		</div>

        <div class="text-center">
            <label class="mr-3">
                <input type="checkbox" data-target='input[name="id"]' class="checkall mt-2 mr-2" value="" aria-label="<?php echo lang('checkall');?>" /><?php echo lang('checkall');?>
            </label>
            <div class="btn-group mod-button my-3" role="group" aria-label="">
                <!--{hook admin_flag_read_mod_delete_before.htm}-->
                <button class="btn btn-danger delete" data-href="<?php echo url('flag-read', array('flagid' => $flagid,'type' => 1));?>"><?php echo lang('delete');?></button>
                <!--{hook admin_flag_read_mod_close_after.htm}-->
            </div>
        </div>

		<!--{hook admin_flag_read_page_before.htm}-->
        <?php if ($pagination) { ?>
		<nav class="my-3"><ul class="pagination justify-content-center flex-wrap"><?php echo $pagination; ?></ul></nav>
        <?php } ?>
		<!--{hook admin_flag_read_page_after.htm}-->
        <a role="button" class="btn btn-secondary btn-block xn-back col-md-6 mx-auto mb-3" href="javascript:history.back();"><?php echo lang('back');?></a>
		<!--{hook admin_flag_read_back_after.htm}-->
	</div>
</div>
</div>
<!--{hook admin_flag_read_end.htm}-->

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>
    var body = $('body');
    body.on('click', 'a.delete', function() {
        var jthis = $(this);
        var href = jthis.data('href');
        $.xpost(href, function(code, message) {
            if(code == 0) {
                jthis.parents('tr').removeDeep();
            } else {
                $.alert(message);
            }
        });
        return false;
    });

    body.on('click', 'button.delete', function() {
        var jthis = $(this);
        var idarr = $('input[name="id"]').checked();
        var href = jthis.data('href');
        if (window.confirm(lang.confirm_delete)) {
            $.xpost(href, {type:1,id:idarr}, function(code, message) {
                if(code == 0) {
                    window.location.reload();
                } else {
                    $.alert(message);
                }
            });
        }
        return false;
    });

    $('#category').addClass('show');
    $('li.category, .menu-flag').addClass('active').find('a').removeClass('collapsed');
</script>

<!--{hook admin_flag_read_js.htm}-->